﻿<?php

class vFrame
{

	private static $js_files = array();

	public static function AddScript($js_file)
	{
		array_push(self::$js_files, $js_file);
	}

	public static function Build($title, $menu, $body)
	{
		$xtpl = new XTemplate('xtpl/page.xtpl');

		foreach (self::$js_files as $js_file) {
			$xtpl->assign("file_name", $js_file);
			$xtpl->parse("root.js_files.js_file");
		}
		$xtpl->parse("root.js_files");

		$xtpl->assign('title', $title);
		$xtpl->assign('menu', $menu);
		$xtpl->assign('body', $body);
		$xtpl->parse('root.body');
		$xtpl->parse('root');
		return $xtpl->text('root');
	}

	public static function BuildWarning($title, $menu, $html)
	{
		$xtpl = new XTemplate('xtpl/page.xtpl');
		$xtpl->assign('title', $title);
		$xtpl->assign('menu', $menu);
		$xtpl->assign('body', $html);
		$xtpl->parse('root.nobody');
		$xtpl->parse('root');
		return $xtpl->text('root');
	}

}